Optimal. Leaf size=91 \[ \frac{a \sin (c+d x)}{d \left (a^2+b^2\right )}+\frac{b \cos (c+d x)}{d \left (a^2+b^2\right )}-\frac{b^2 \tanh ^{-1}\left (\frac{b \cos (c+d x)-a \sin (c+d x)}{\sqrt{a^2+b^2}}\right )}{d \left (a^2+b^2\right )^{3/2}} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.0817828, antiderivative size = 91, normalized size of antiderivative = 1., number of steps used = 4, number of rules used = 4, integrand size = 28, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.143, Rules used = {3100, 2637, 3074, 206} \[ \frac{a \sin (c+d x)}{d \left (a^2+b^2\right )}+\frac{b \cos (c+d x)}{d \left (a^2+b^2\right )}-\frac{b^2 \tanh ^{-1}\left (\frac{b \cos (c+d x)-a \sin (c+d x)}{\sqrt{a^2+b^2}}\right )}{d \left (a^2+b^2\right )^{3/2}} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 3100
Rule 2637
Rule 3074
Rule 206
Rubi steps
\begin{align*} \int \frac{\cos ^2(c+d x)}{a \cos (c+d x)+b \sin (c+d x)} \, dx &=\frac{b \cos (c+d x)}{\left (a^2+b^2\right ) d}+\frac{a \int \cos (c+d x) \, dx}{a^2+b^2}+\frac{b^2 \int \frac{1}{a \cos (c+d x)+b \sin (c+d x)} \, dx}{a^2+b^2}\\ &=\frac{b \cos (c+d x)}{\left (a^2+b^2\right ) d}+\frac{a \sin (c+d x)}{\left (a^2+b^2\right ) d}-\frac{b^2 \operatorname{Subst}\left (\int \frac{1}{a^2+b^2-x^2} \, dx,x,b \cos (c+d x)-a \sin (c+d x)\right )}{\left (a^2+b^2\right ) d}\\ &=-\frac{b^2 \tanh ^{-1}\left (\frac{b \cos (c+d x)-a \sin (c+d x)}{\sqrt{a^2+b^2}}\right )}{\left (a^2+b^2\right )^{3/2} d}+\frac{b \cos (c+d x)}{\left (a^2+b^2\right ) d}+\frac{a \sin (c+d x)}{\left (a^2+b^2\right ) d}\\ \end{align*}
Mathematica [A] time = 0.180227, size = 79, normalized size = 0.87 \[ \frac{\sqrt{a^2+b^2} (a \sin (c+d x)+b \cos (c+d x))+2 b^2 \tanh ^{-1}\left (\frac{a \tan \left (\frac{1}{2} (c+d x)\right )-b}{\sqrt{a^2+b^2}}\right )}{d \left (a^2+b^2\right )^{3/2}} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A] time = 0.132, size = 90, normalized size = 1. \begin{align*}{\frac{1}{d} \left ( 2\,{\frac{{b}^{2}}{ \left ({a}^{2}+{b}^{2} \right ) ^{3/2}}{\it Artanh} \left ( 1/2\,{\frac{2\,a\tan \left ( 1/2\,dx+c/2 \right ) -2\,b}{\sqrt{{a}^{2}+{b}^{2}}}} \right ) }-2\,{\frac{-a\tan \left ( 1/2\,dx+c/2 \right ) -b}{ \left ({a}^{2}+{b}^{2} \right ) \left ( 1+ \left ( \tan \left ( 1/2\,dx+c/2 \right ) \right ) ^{2} \right ) }} \right ) } \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F(-2)] time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: ValueError} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [B] time = 0.520005, size = 436, normalized size = 4.79 \begin{align*} \frac{\sqrt{a^{2} + b^{2}} b^{2} \log \left (-\frac{2 \, a b \cos \left (d x + c\right ) \sin \left (d x + c\right ) +{\left (a^{2} - b^{2}\right )} \cos \left (d x + c\right )^{2} - 2 \, a^{2} - b^{2} + 2 \, \sqrt{a^{2} + b^{2}}{\left (b \cos \left (d x + c\right ) - a \sin \left (d x + c\right )\right )}}{2 \, a b \cos \left (d x + c\right ) \sin \left (d x + c\right ) +{\left (a^{2} - b^{2}\right )} \cos \left (d x + c\right )^{2} + b^{2}}\right ) + 2 \,{\left (a^{2} b + b^{3}\right )} \cos \left (d x + c\right ) + 2 \,{\left (a^{3} + a b^{2}\right )} \sin \left (d x + c\right )}{2 \,{\left (a^{4} + 2 \, a^{2} b^{2} + b^{4}\right )} d} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F(-1)] time = 0., size = 0, normalized size = 0. \begin{align*} \text{Timed out} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A] time = 1.28761, size = 159, normalized size = 1.75 \begin{align*} -\frac{\frac{b^{2} \log \left (\frac{{\left | 2 \, a \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right ) - 2 \, b - 2 \, \sqrt{a^{2} + b^{2}} \right |}}{{\left | 2 \, a \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right ) - 2 \, b + 2 \, \sqrt{a^{2} + b^{2}} \right |}}\right )}{{\left (a^{2} + b^{2}\right )}^{\frac{3}{2}}} - \frac{2 \,{\left (a \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right ) + b\right )}}{{\left (a^{2} + b^{2}\right )}{\left (\tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right )^{2} + 1\right )}}}{d} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]